﻿// (c) Copyright Microsoft Corporation.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Security;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace Coding4Fun.Kinect.Wpf
{
    public static class BitmapSourceExtensions
    {


		public static BitmapSource ToBitmapSource(this byte[] pixels, int width, int height)
		{
			return ToBitmapSource(pixels, width, height, PixelFormats.Bgr32);
		}

		public static BitmapSource ToBitmapSource(this byte[] pixels, int width, int height, PixelFormat format)
		{
			return BitmapSource.Create(width, height, 96, 96, format, null, pixels, width * format.BitsPerPixel / 8);
		}
    }
}